%==========================================================================
%=  This file is part of the AEO-Light Sound Restoration Project
%=  (c) Copyright 2012 Interdisciplinary Mathematics Institute
%=      University of South Carolina, Department of Mathematics
%=  ALL RIGHTS RESERVED
%=
%=  Author: L. Scott Johnson
%==========================================================================

%==========================================================================
% The function "gui_set" sets the given property of the hObject and then
% calls the Callback function for that object (unless it's already being
% executed and this is a recursion to that object).
% INPUT: "hObject", "property", and "value" like the standard set() function
%==========================================================================

function gui_set(hObject, property, value)

set(hObject, property, value);

% make sure we don't loop back to a callback recursively
userdata = get(hObject, 'UserData');
if(isstruct(userdata) && isfield(userdata, 'incallback'))
	return;
end

% flag this object as "in callback"
newdata = userdata;
newdata.incallback = true;
set(hObject, 'UserData', newdata);

try
    cb = get(hObject,'Callback');
    cb(hObject, []);
catch exception
    gui_exception(exception);
end

% reset UserData to original value
set(hObject, 'UserData', userdata);
 
return;

end
